<template>
	<view>
		<v-tabhead @barTap="barTap" :headItems="headItems" :activeIndex="activeIndex"></v-tabhead>

		<swiper @change="changeTab" :current="activeIndex" class="swiperContainer">
		  <swiper-item v-for="(items, index) in headItems" :key="index">
				<msg-list :curIndex="activeIndex" :selfIndex="items.selfIndex" :mailType="items.mailType"></msg-list>
		  </swiper-item>
		</swiper>
	</view>
</template>

<script>
	import VTabhead from "@/pages/tabbar/mine/collect/fragment/vtabhead/index";
	import msgList from './fragments/msgList';
	export default{
		components:{
			VTabhead,
			msgList
		},
		data(){
			return{
				headItems: [
				  {
				    code: "personal",
				    title: "个人消息",
					selfIndex:0,
					mailType:'1'
				  },
				  {
				    code: "system",
				    title: "系统消息",
					selfIndex:1,
					mailType:'2'
				  }
				],
				activeIndex: 0
			}
		},
		onLoad() {
			
		},
		onUnload() {
			
		},
		methods:{
			barTap(activeIndex) {
			    this.activeIndex = activeIndex;
			},
			changeTab(e){
				this.activeIndex = e.target.current;
			},
			
		}
		
	}
</script>

<style lang="scss" scoped>
	.swiperContainer{
		width: 100%;
		height: calc(100vh - 30px);
		flex: 1;
		background-color: #fff;
	}
</style>
